<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Pandas数据运算 | Python 数据分析学习目录</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../数据分析库的操作/7.1Pandas数据运算拓展.html" />
    
    
    <link rel="prev" href="../数据分析库的操作/6Pandas数据存取.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="4.4.3"
        data-chapter-title="Pandas数据运算"
        data-filepath="数据分析库的操作/7Pandas数据运算.md"
        data-basepath=".."
        data-revision="Wed Oct 24 2018 21:30:49 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        数据分析
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="Python数据分析序言/内容序言.html">
            
                
                    <a href="../Python数据分析序言/内容序言.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Python数据分析内容
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2" data-path="python数据分析环境和工具/Python数据分析相关.html">
            
                
                    <a href="../python数据分析环境和工具/Python数据分析相关.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        python数据分析环境和工具
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="python数据分析环境和工具/1Python数据课程软件和环境安装.html">
            
                
                    <a href="../python数据分析环境和工具/1Python数据课程软件和环境安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        Python数据课程 软件和环境安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="python数据分析环境和工具/2python发行版.html">
            
                
                    <a href="../python数据分析环境和工具/2python发行版.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        python发行版
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="python数据分析环境和工具/5交互式编辑器-JupyterNotebook.html">
            
                
                    <a href="../python数据分析环境和工具/5交互式编辑器-JupyterNotebook.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        交互式编辑器-JupyterNotebook
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="python数据分析环境和工具/5.1Jupyter-notebook拓展应用.html">
            
                
                    <a href="../python数据分析环境和工具/5.1Jupyter-notebook拓展应用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        Jupyter-notebook拓展应用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="python数据分析环境和工具/包和环境管理器：conda.html">
            
                
                    <a href="../python数据分析环境和工具/包和环境管理器：conda.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        包和环境管理器：conda
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="python数据分析环境和工具/pip和Virtualenv.html">
            
                
                    <a href="../python数据分析环境和工具/pip和Virtualenv.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.1.</b>
                        
                        pip和Virtualenv
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="python数据分析环境和工具/3Markdown.html">
            
                
                    <a href="../python数据分析环境和工具/3Markdown.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        标记语言：Markdown
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="python数据分析环境和工具/4Markdown语法.html">
            
                
                    <a href="../python数据分析环境和工具/4Markdown语法.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.1.</b>
                        
                        Markdown语法
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="python数据分析环境和工具/6Gitbook文档.html">
            
                
                    <a href="../python数据分析环境和工具/6Gitbook文档.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.2.</b>
                        
                        文档管理工具-Gitbook
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="数据分析库的初步认识/index.html">
            
                
                    <a href="../数据分析库的初步认识/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        数据分析库-Pandas
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="数据分析库的初步认识/Pandas创建.html">
            
                
                    <a href="../数据分析库的初步认识/Pandas创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        pandas
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="数据分析库的初步认识/Series创建.html">
            
                
                    <a href="../数据分析库的初步认识/Series创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        Series
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="数据分析库的初步认识/DataFrame创建.html">
            
                
                    <a href="../数据分析库的初步认识/DataFrame创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        DataFrame对象-创建
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" >
            
            <span><b>4.</b> 数据分析库的操作</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="数据分析库的操作/1DataFrame查询1-整体.html">
            
                
                    <a href="../数据分析库的操作/1DataFrame查询1-整体.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        DataFrame查询1-整体
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="数据分析库的操作/2DataFrame查询2-专用查询.html">
            
                
                    <a href="../数据分析库的操作/2DataFrame查询2-专用查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        DataFrame查询2-专用查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="数据分析库的操作/3DataFrame查询3-专有查询：过滤查询.html">
            
                
                    <a href="../数据分析库的操作/3DataFrame查询3-专有查询：过滤查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        DataFrame查询3-专有查询：过滤查询
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="数据分析库的操作/4Pandas对象的数据操作：增删改查.html">
            
                
                    <a href="../数据分析库的操作/4Pandas对象的数据操作：增删改查.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        Pandas对象的数据操作：增删改查
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.1" data-path="数据分析库的操作/5Pandas数据操作：其他操作.html">
            
                
                    <a href="../数据分析库的操作/5Pandas数据操作：其他操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.1.</b>
                        
                        Pandas数据操作：其他操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.2" data-path="数据分析库的操作/6Pandas数据存取.html">
            
                
                    <a href="../数据分析库的操作/6Pandas数据存取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.2.</b>
                        
                        Pandas数据存取
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="4.4.3" data-path="数据分析库的操作/7Pandas数据运算.html">
            
                
                    <a href="../数据分析库的操作/7Pandas数据运算.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.3.</b>
                        
                        Pandas数据运算
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.3.1" data-path="数据分析库的操作/7.1Pandas数据运算拓展.html">
            
                
                    <a href="../数据分析库的操作/7.1Pandas数据运算拓展.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.3.1.</b>
                        
                        Pandas数据运算-拓展
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4.4" data-path="数据分析库的操作/8Pandas分组聚合1.html">
            
                
                    <a href="../数据分析库的操作/8Pandas分组聚合1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.4.</b>
                        
                        Pandas分组聚合1
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.5" data-path="数据分析库的操作/9Pandas分组聚合2.html">
            
                
                    <a href="../数据分析库的操作/9Pandas分组聚合2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.5.</b>
                        
                        Pandas分组聚合2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.6" data-path="数据分析库的操作/10Pandas数据规整-清理.html">
            
                
                    <a href="../数据分析库的操作/10Pandas数据规整-清理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.6.</b>
                        
                        Pandas数据规整-清理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4.7" data-path="数据分析库的操作/11Pandas数据规整-转换.html">
            
                
                    <a href="../数据分析库的操作/11Pandas数据规整-转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.7.</b>
                        
                        Pandas数据规整-转换
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.7.1" data-path="数据分析库的操作/14Pandas数据规整-转换-离散化和面元划分.html">
            
                
                    <a href="../数据分析库的操作/14Pandas数据规整-转换-离散化和面元划分.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.7.1.</b>
                        
                        离散化和面元划分
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4.8" data-path="数据分析库的操作/16Pandas数据规整-合并.html">
            
                
                    <a href="../数据分析库的操作/16Pandas数据规整-合并.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.8.</b>
                        
                        Pandas数据规整-合并
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="数据分析库的操作/13Pandas数据规整-重塑和轴向旋转.html">
            
                
                    <a href="../数据分析库的操作/13Pandas数据规整-重塑和轴向旋转.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        Pandas数据规整-重塑和轴向旋转
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="数据分析库的操作/13.1透视表和交叉表.html">
            
                
                    <a href="../数据分析库的操作/13.1透视表和交叉表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.1.</b>
                        
                        透视表和交叉表
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="Python可视化/绘图库-Matplotlib.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Python可视化
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="Python可视化/绘图库-Matplotlib/Matplotlib常见图表.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/Matplotlib常见图表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        基础：Matplotlib常见图表
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="Python可视化/绘图库-Matplotlib/Matplotlib常见设置和操作.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/Matplotlib常见设置和操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.1.</b>
                        
                        Matplotlib常见设置和操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="Python可视化/绘图库-Matplotlib/1Matplotlib-绘图区域.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/1Matplotlib-绘图区域.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        提升：绘图区域
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="Python可视化/绘图库-Matplotlib/2Matplotlib-图像组件.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/2Matplotlib-图像组件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        提升：绘图组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="Python可视化/绘图库-Matplotlib/3Matplotlib-高级绘图.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/3Matplotlib-高级绘图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        拓展：高级绘图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="Python可视化/绘图库-Matplotlib/4数学计算展示图像.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/4数学计算展示图像.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        拓展：数学计算展示图像
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="Python可视化/绘图库-Matplotlib/5注意事项.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/5注意事项.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        拓展：注意事项
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="Python可视化/绘图库-Matplotlib/6pylab.html">
            
                
                    <a href="../Python可视化/绘图库-Matplotlib/6pylab.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        拓展：pylab
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="数据分析必备知识点/数据分析必备知识点汇集.html">
            
                
                    <a href="../数据分析必备知识点/数据分析必备知识点汇集.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        数据分析必备知识点
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="数据分析必备知识点/数据分析流程.html">
            
                
                    <a href="../数据分析必备知识点/数据分析流程.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        数据分析流程
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../" >Python 数据分析学习目录</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="pandas&#x6570;&#x636E;&#x8FD0;&#x7B97;">Pandas&#x6570;&#x636E;&#x8FD0;&#x7B97;</h1>
<hr>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd
</code></pre>
<pre><code class="lang-python"><span class="hljs-comment"># &#x6570;&#x636E;</span>
a = pd.Series([<span class="hljs-number">9</span>,<span class="hljs-number">8</span>,<span class="hljs-number">7</span>,<span class="hljs-number">6</span>],index=[<span class="hljs-string">&apos;a&apos;</span>,<span class="hljs-string">&apos;b&apos;</span>,<span class="hljs-string">&apos;c&apos;</span>,<span class="hljs-string">&apos;d&apos;</span>])
a
</code></pre>
<pre><code>a    9
b    8
c    7
d    6
dtype: int64
</code></pre><pre><code class="lang-python">b = pd.DataFrame(np.arange(<span class="hljs-number">20</span>).reshape(<span class="hljs-number">4</span>,<span class="hljs-number">5</span>),index=[<span class="hljs-string">&apos;c&apos;</span>,<span class="hljs-string">&apos;a&apos;</span>,<span class="hljs-string">&apos;d&apos;</span>,<span class="hljs-string">&apos;b&apos;</span>])
b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>



<p>python&#x79D1;&#x5B66;&#x8BA1;&#x7B97;&#x7684;&#x57FA;&#x672C;&#x65B9;&#x5F0F;&#x662F;&#xFF1A;&#x5411;&#x91CF;&#x5316;&#x8FD0;&#x7B97;&#xFF08;&#x77E2;&#x91CF;&#x5316;&#x8FD0;&#x7B97;&#xFF09;&#xFF0C;&#x5E76;&#x884C;&#x8FD0;&#x7B97;</p>
<h1 id="&#x81EA;&#x5B9A;&#x4E49;&#x8FD0;&#x7B97;">&#x81EA;&#x5B9A;&#x4E49;&#x8FD0;&#x7B97;</h1>
<ul>
<li>Series<ul>
<li>map()</li>
</ul>
</li>
<li>DataFrame<ul>
<li>apply()</li>
<li>applymap()</li>
</ul>
</li>
</ul>
<ul>
<li>&#x5982;&#x679C;Pandas&#x5E93;&#x81EA;&#x5E26;&#x7684;&#x8FD0;&#x7B97;&#x548C;&#x51FD;&#x6570;&#x4E0D;&#x6EE1;&#x8DB3;&#x9700;&#x6C42;&#xFF0C;&#x53EF;&#x4EE5;&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#xFF0C;&#x5E76;&#x540C;&#x65F6;&#x5C06;&#x51FD;&#x6570;&#x5E94;&#x7528;&#x5230;Pandas&#x7684;&#x6BCF;&#x884C;&#xFF0F;&#x5217;&#x6216;&#x503C;&#x4E0A;</li>
<li>&#x5E94;&#x7528;&#x51FD;&#x6570;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x66FF;&#x4EE3;&#x4F20;&#x7EDF;&#x7684;for&#x5FAA;&#x73AF;</li>
</ul>
<p>&#x9488;&#x5BF9;Series&#x7684;map&#x51FD;&#x6570;&#xFF0C;&#x4F1A;&#x5C06;&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x5E94;&#x7528;&#x5230;Series&#x5BF9;&#x8C61;&#x7684;&#x6BCF;&#x4E2A;&#x503C;</p>
<h2 id="series-&#x7684;map&#x51FD;&#x6570;">Series &#x7684;map&#x51FD;&#x6570;</h2>
<pre><code class="lang-python">a
</code></pre>
<pre><code>a    9
b    8
c    7
d    6
dtype: int64
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># &#x81EA;&#x5B9A;&#x4E49;&#x8FD0;&#x7B97;&#x51FD;&#x6570;</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">xxx</span><span class="hljs-params">(x)</span>:</span>
    <span class="hljs-keyword">return</span> x + <span class="hljs-number">1</span> - <span class="hljs-number">2</span> * <span class="hljs-number">3</span> / <span class="hljs-number">4</span>

<span class="hljs-comment">#&#x5411;&#x91CF;&#x5316;&#x8FD0;&#x7B97;</span>
a.map(xxx)
</code></pre>
<pre><code>a    8.5
b    7.5
c    6.5
d    5.5
dtype: float64
</code></pre><pre><code class="lang-python"><span class="hljs-number">9</span> + <span class="hljs-number">1</span> - <span class="hljs-number">2</span> * <span class="hljs-number">3</span> / <span class="hljs-number">4</span>
</code></pre>
<pre><code>8.5
</code></pre><h2 id="dataframe&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x64CD;&#x4F5C;">DataFrame&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x64CD;&#x4F5C;</h2>
<p>apply:&#x64CD;&#x4F5C; &#x884C;&#x3001;&#x5217;</p>
<p>applymap&#xFF1A;&#x64CD;&#x4F5C;&#x5355;&#x5143;&#x683C;</p>
<pre><code class="lang-python">b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-comment"># &#x81EA;&#x5B9A;&#x4E49;&#x8FD0;&#x7B97;&#x51FD;&#x6570;</span>
<span class="hljs-comment"># def yyy(x):</span>
<span class="hljs-comment">#     return x + 1 - 2 * 3 / 4</span>

<span class="hljs-comment">#lambda &#x8868;&#x8FBE;&#x5F0F;(&#x533F;&#x540D;&#x51FD;&#x6570;)</span>
yyy = <span class="hljs-keyword">lambda</span> x:x + <span class="hljs-number">1</span> - <span class="hljs-number">2</span> * <span class="hljs-number">3</span> / <span class="hljs-number">4</span>

b.apply(yyy)
b.applymap(yyy)
<span class="hljs-comment">#&#x76F4;&#x63A5;&#x5E94;&#x7528;&#x4E8E;&#x5355;&#x5143;&#x683C;&#x7684;&#x7B97;&#x6CD5;&#xFF0C;&#x4E24;&#x4E2A;&#x51FD;&#x6570;&#x6548;&#x679C;&#x4E00;&#x6837;</span>
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>-0.5</td>
      <td>0.5</td>
      <td>1.5</td>
      <td>2.5</td>
      <td>3.5</td>
    </tr>
    <tr>
      <th>a</th>
      <td>4.5</td>
      <td>5.5</td>
      <td>6.5</td>
      <td>7.5</td>
      <td>8.5</td>
    </tr>
    <tr>
      <th>d</th>
      <td>9.5</td>
      <td>10.5</td>
      <td>11.5</td>
      <td>12.5</td>
      <td>13.5</td>
    </tr>
    <tr>
      <th>b</th>
      <td>14.5</td>
      <td>15.5</td>
      <td>16.5</td>
      <td>17.5</td>
      <td>18.5</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-number">15</span> + <span class="hljs-number">1</span> - <span class="hljs-number">2</span> * <span class="hljs-number">3</span> / <span class="hljs-number">4</span>
</code></pre>
<pre><code>14.5
</code></pre><p>&#x4E0D;&#x76F4;&#x63A5;&#x5E94;&#x7528;&#x4E8E;&#x5355;&#x5143;&#x683C;&#x7684;&#x7B97;&#x6CD5;</p>
<pre><code class="lang-python">b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>



<h2 id="&#x5173;&#x4E8E;&#x884C;&#x548C;&#x5217;&#x7684;&#x601D;&#x8DEF;">&#x5173;&#x4E8E;&#x884C;&#x548C;&#x5217;&#x7684;&#x601D;&#x8DEF;</h2>
<ul>
<li>axis = 0 &#x6309;&#x884C;&#x64CD;&#x4F5C;<ul>
<li>&#x7ED9;&#x8FD9;&#x4E00;&#x5217;&#x7684;&#x6240;&#x6709;&#x884C;&#xFF0C;&#x8FDB;&#x884C;&#x8BA1;&#x7B97;  &#xFF08;&#x8BF4;&#x767D;&#x4E86;&#x5C31;&#x662F;axis&#x4EE3;&#x8868;&#x7684;&#x662F;&#x5217;&#xFF0C;&#x4F46;&#x662F;&#x8BA1;&#x7B97;&#x91CC;&#x8BA1;&#x7B97;&#x7684;&#x662F;&#x8FD9;&#x4E00;&#x884C;&#x3002;&#xFF09;</li>
</ul>
</li>
<li>axis =1 &#x6309;&#x5217;&#x64CD;&#x4F5C;<ul>
<li>&#x7ED9;&#x8FD9;&#x4E00;&#x884C;&#x7684;&#x6240;&#x6709;&#x5217;&#xFF0C;&#x8FDB;&#x884C;&#x8FD0;&#x7B97;</li>
</ul>
</li>
</ul>
<p><strong> DataFrame&#x7684;apply&#x81EA;&#x5B9A;&#x4E49;&#x51FD;&#x6570;&#x5E94;&#x7528;&#xFF0C;&#x590D;&#x6742;&#xFF0C;&#x91CD;&#x8981;</strong></p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">zzz</span><span class="hljs-params">(x)</span>:</span>

    <span class="hljs-keyword">return</span> x.min()  <span class="hljs-comment">#&#x8FD4;&#x56DE;&#x884C;&#x3001;&#x5217;&#x7684;&#x6700;&#x5C0F;&#x503C;</span>

b.apply(zzz) <span class="hljs-comment"># &#x9ED8;&#x8BA4;&#x6309;&#x884C;&#x64CD;&#x4F5C;&#xFF0C;&#x5C31;&#x662F;&#x6BCF;&#x4E00;&#x5217;&#x7684;&#x6240;&#x6709;&#x884C;&#x4E0A;&#x7684;&#x6570;&#x5B57;&#x3002;</span>
b.apply(zzz,axis = <span class="hljs-number">0</span>)  <span class="hljs-comment">#&#x4E0A;&#x9762;&#x884C;&#x7684;&#x5B8C;&#x6574;&#x5199;&#x6CD5;</span>
</code></pre>
<pre><code>0    0
1    1
2    2
3    3
4    4
dtype: int64
</code></pre><pre><code class="lang-python">b.apply(zzz,axis = <span class="hljs-number">1</span>) <span class="hljs-comment">#&#x6309;&#x5217;&#x64CD;&#x4F5C;  &#x5C31;&#x662F;&#x6BCF;&#x4E00;&#x884C;&#x7684;&#x6240;&#x6709;&#x5217;&#x3002;</span>
</code></pre>
<pre><code>c     0
a     5
d    10
b    15
dtype: int64
</code></pre><pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">zzz</span><span class="hljs-params">(x)</span>:</span>
    <span class="hljs-keyword">return</span> x.min(),x.max()

b.apply(zzz,axis=<span class="hljs-number">1</span>)
</code></pre>
<pre><code>c      (0, 4)
a      (5, 9)
d    (10, 14)
b    (15, 19)
dtype: object
</code></pre><pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">zzz</span><span class="hljs-params">(x)</span>:</span>
<span class="hljs-comment">#     return x.min(),x.max()</span>

<span class="hljs-comment">#&#x8F93;&#x51FA;DataFrame ******************************************</span>

    <span class="hljs-keyword">return</span> pd.Series([x.min(), x.max()], index = [<span class="hljs-string">&apos;&#x6700;&#x5C0F;&#x503C;&apos;</span>, <span class="hljs-string">&apos;&#x6700;&#x5927;&#x503C;&apos;</span>])

b.apply(zzz,axis=<span class="hljs-number">1</span>)
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>&#x6700;&#x5C0F;&#x503C;</th>
      <th>&#x6700;&#x5927;&#x503C;</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>



<hr>
<h1 id="&#x57FA;&#x672C;&#x7EDF;&#x8BA1;&#x51FD;&#x6570;">&#x57FA;&#x672C;&#x7EDF;&#x8BA1;&#x51FD;&#x6570;</h1>
<p>Pandas&#x7684;&#x7EDF;&#x8BA1;&#x8FD0;&#x7B97;&#x65B9;&#x6CD5;&#xFF0C;&#x548C;Numpy&#x57FA;&#x672C;&#x4E00;&#x81F4;</p>
<p>&#x9ED8;&#x8BA4;&#x9488;&#x5BF9;0&#x8F74;&#xFF08;&#x884C;&#xFF09;&#x505A;&#x8FD0;&#x7B97;&#xFF0C;&#x5927;&#x90E8;&#x5206;&#x51FD;&#x6570;&#x53EF;&#x52A0;&#x53C2;&#x6570; axis=1 &#x6539;&#x4E3A;&#x5BF9;&#x5217;&#x8FD0;&#x7B97;</p>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;</th>
<th>&#x89E3;&#x91CA;</th>
</tr>
</thead>
<tbody>
<tr>
<td>.describe()</td>
<td>&#x9488;&#x5BF9;0&#x8F74;&#x7684;&#x7EDF;&#x8BA1;&#x6C47;&#x603B;&#xFF0C;&#x8BA1;&#x6570;/&#x5E73;&#x5747;&#x503C;/&#x6807;&#x51C6;&#x5DEE;/&#x6700;&#x5C0F;&#x503C;/&#x56DB;&#x5206;&#x4F4D;&#x6570;/&#x6700;&#x5927;&#x503C;</td>
</tr>
<tr>
<td>.sum()</td>
<td>&#x8BA1;&#x7B97;&#x6570;&#x636E;&#x7684;&#x603B;&#x548C;,&#x6309;0&#x8F74;&#x8BA1;&#x7B97;(&#x5404;&#x884C;&#x8BA1;&#x7B97;),&#x4E0B;&#x540C;,&#x8981;&#x6309;&#x5217;&#x8BA1;&#x7B97;&#x53C2;&#x6570;1</td>
</tr>
<tr>
<td>.count()</td>
<td>&#x975E;NaN&#x503C;&#x6570;&#x91CF;</td>
</tr>
<tr>
<td>.mean() .median() .mode()</td>
<td>&#x8BA1;&#x7B97;&#x6570;&#x636E;&#x7684;&#x7B97;&#x6570;&#x5E73;&#x5747;&#x503C;/&#x4E2D;&#x4F4D;&#x6570;/&#x4F17;&#x6570;</td>
</tr>
<tr>
<td>.var() .std()</td>
<td>&#x8BA1;&#x7B97;&#x6570;&#x636E;&#x7684;&#x65B9;&#x5DEE;/&#x6807;&#x51C6;&#x5DEE;</td>
</tr>
<tr>
<td>.min() .max()</td>
<td>&#x8BA1;&#x7B97;&#x6570;&#x636E;&#x7684;&#x6700;&#x5C0F;&#x503C;/&#x6700;&#x5927;&#x503C;</td>
</tr>
<tr>
<td>.idxmin() .idxmax()</td>
<td>&#x8BA1;&#x7B97;&#x6570;&#x636E;&#x7B2C;&#x4E00;&#x4E2A;&#x6700;&#x5927;&#x503C;/&#x6700;&#x5C0F;&#x503C;&#x6240;&#x5728;&#x4F4D;&#x7F6E;&#x7684;&#x7D22;&#x5F15;&#xFF0C;&#x7ED9;&#x7D22;&#x5F15;&#x6216;&#x5207;&#x7247;&#x4F7F;&#x7528;(&#x81EA;&#x5B9A;&#x4E49;&#x7D22;&#x5F15;&#xFF0C;&#x6392;&#x9664;null/NA&#x7B49;&#x7A7A;&#x503C;)</td>
</tr>
</tbody>
</table>
<pre><code class="lang-python">b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python"><span class="hljs-comment"># &#x6C42;&#x548C;</span>
b.sum()  <span class="hljs-comment">#&#x6309;&#x884C;&#x6C42;&#x548C;</span>
b.sum(axis = <span class="hljs-number">0</span>)  <span class="hljs-comment">#&#x8FD9;&#x4E00;&#x5217;&#x7684;&#x6240;&#x6709;&#x884C;&#xFF0C;&#x6C42;&#x548C;</span>
</code></pre>
<pre><code>0    30
1    34
2    38
3    42
4    46
dtype: int64
</code></pre><pre><code class="lang-python"><span class="hljs-number">0</span> + <span class="hljs-number">5</span> + <span class="hljs-number">10</span> + <span class="hljs-number">15</span>
</code></pre>
<pre><code>30
</code></pre><pre><code class="lang-python">b.sum(axis=<span class="hljs-number">1</span>)  <span class="hljs-comment">#&#x6309;&#x5217;&#x6C42;&#x548C;&#xFF1A; 0 1 2 3 4 </span>

<span class="hljs-comment">#&#x8FD9;&#x4E00;&#x884C;&#x7684;&#x6240;&#x6709;&#x5217;&#xFF0C;&#x6C42;&#x548C;</span>
</code></pre>
<pre><code>c    10
a    35
d    60
b    85
dtype: int64
</code></pre><p>&#x6C42;&#x6700;&#x5C0F;&#x503C;&#xFF0C;&#x6700;&#x5927;&#x503C;&#x7684;&#x7D22;&#x5F15;</p>
<pre><code class="lang-python">a
</code></pre>
<pre><code>a    9
b    8
c    7
d    6
dtype: int64
</code></pre><pre><code class="lang-python">a.argmin()  <span class="hljs-comment">#&#x5373;&#x5C06;&#x88AB;&#x5E9F;&#x5F03;&#xFF0C;&#x5EFA;&#x8BAE;&#x6539;&#x7528;idxmin(),inxmax()</span>
</code></pre>
<pre><code>D:\Anaconda\anaconda\lib\site-packages\ipykernel_launcher.py:1: FutureWarning: &apos;argmin&apos; is deprecated, use &apos;idxmin&apos; instead. The behavior of &apos;argmin&apos;
will be corrected to return the positional minimum in the future.
Use &apos;series.values.argmin&apos; to get the position of the minimum now.
  &quot;&quot;&quot;Entry point for launching an IPython kernel.





&apos;d&apos;
</code></pre><pre><code class="lang-python">a.idxmax()
</code></pre>
<pre><code>&apos;a&apos;
</code></pre><pre><code class="lang-python"><span class="hljs-comment"># dataframe</span>
b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">b.idxmin()  <span class="hljs-comment">#&#x6C42;&#x6700;&#x5C0F;&#x503C;&#x7684;&#x7D22;&#x5F15;&#x662F;&#x5565;</span>
</code></pre>
<pre><code>0    c
1    c
2    c
3    c
4    c
dtype: object
</code></pre><pre><code class="lang-python">b.idxmax(axis=<span class="hljs-number">1</span>)  <span class="hljs-comment">#&#x6C42;&#x6700;&#x5927;&#x503C;&#x7684;&#x7D22;&#x5F15;&#x662F;&#x5565;</span>
</code></pre>
<pre><code>c    4
a    4
d    4
b    4
dtype: int64
</code></pre><h5 id="&#x5FEB;&#x901F;&#x7EFC;&#x5408;&#x7EDF;&#x8BA1;&#x6307;&#x6807;">&#x5FEB;&#x901F;&#x7EFC;&#x5408;&#x7EDF;&#x8BA1;&#x6307;&#x6807;</h5>
<pre><code class="lang-python">a
</code></pre>
<pre><code>a    9
b    8
c    7
d    6
dtype: int64
</code></pre><pre><code class="lang-python">a.describe()
</code></pre>
<pre><code>count    4.000000
mean     7.500000
std      1.290994
min      6.000000
25%      6.750000
50%      7.500000
75%      8.250000
max      9.000000
dtype: float64
</code></pre><pre><code class="lang-python">type(a.describe())
</code></pre>
<pre><code>pandas.core.series.Series
</code></pre><pre><code class="lang-python">a.describe()[<span class="hljs-string">&apos;min&apos;</span>]
</code></pre>
<pre><code>6.0
</code></pre><pre><code class="lang-python">b
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>c</th>
      <td>0</td>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <th>a</th>
      <td>5</td>
      <td>6</td>
      <td>7</td>
      <td>8</td>
      <td>9</td>
    </tr>
    <tr>
      <th>d</th>
      <td>10</td>
      <td>11</td>
      <td>12</td>
      <td>13</td>
      <td>14</td>
    </tr>
    <tr>
      <th>b</th>
      <td>15</td>
      <td>16</td>
      <td>17</td>
      <td>18</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">b.describe()
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>count</th>
      <td>4.000000</td>
      <td>4.000000</td>
      <td>4.000000</td>
      <td>4.000000</td>
      <td>4.000000</td>
    </tr>
    <tr>
      <th>mean</th>
      <td>7.500000</td>
      <td>8.500000</td>
      <td>9.500000</td>
      <td>10.500000</td>
      <td>11.500000</td>
    </tr>
    <tr>
      <th>std</th>
      <td>6.454972</td>
      <td>6.454972</td>
      <td>6.454972</td>
      <td>6.454972</td>
      <td>6.454972</td>
    </tr>
    <tr>
      <th>min</th>
      <td>0.000000</td>
      <td>1.000000</td>
      <td>2.000000</td>
      <td>3.000000</td>
      <td>4.000000</td>
    </tr>
    <tr>
      <th>25%</th>
      <td>3.750000</td>
      <td>4.750000</td>
      <td>5.750000</td>
      <td>6.750000</td>
      <td>7.750000</td>
    </tr>
    <tr>
      <th>50%</th>
      <td>7.500000</td>
      <td>8.500000</td>
      <td>9.500000</td>
      <td>10.500000</td>
      <td>11.500000</td>
    </tr>
    <tr>
      <th>75%</th>
      <td>11.250000</td>
      <td>12.250000</td>
      <td>13.250000</td>
      <td>14.250000</td>
      <td>15.250000</td>
    </tr>
    <tr>
      <th>max</th>
      <td>15.000000</td>
      <td>16.000000</td>
      <td>17.000000</td>
      <td>18.000000</td>
      <td>19.000000</td>
    </tr>
  </tbody>
</table>
</div>




<pre><code class="lang-python">type(b.describe())  <span class="hljs-comment"># df&#x7C7B;&#x578B;</span>
</code></pre>
<pre><code>pandas.core.frame.DataFrame
</code></pre><pre><code class="lang-python">b.describe()[<span class="hljs-number">4</span>]
</code></pre>
<pre><code>count     4.000000
mean     11.500000
std       6.454972
min       4.000000
25%       7.750000
50%      11.500000
75%      15.250000
max      19.000000
Name: 4, dtype: float64
</code></pre><pre><code class="lang-python">b.describe().loc[[<span class="hljs-string">&apos;min&apos;</span>, <span class="hljs-string">&apos;max&apos;</span>],[<span class="hljs-number">0</span>, <span class="hljs-number">2</span>, <span class="hljs-number">4</span>]]
</code></pre>
<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>2</th>
      <th>4</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>min</th>
      <td>0.0</td>
      <td>2.0</td>
      <td>4.0</td>
    </tr>
    <tr>
      <th>max</th>
      <td>15.0</td>
      <td>17.0</td>
      <td>19.0</td>
    </tr>
  </tbody>
</table>
</div>



                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../数据分析库的操作/6Pandas数据存取.html" class="navigation navigation-prev " aria-label="Previous page: Pandas数据存取"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../数据分析库的操作/7.1Pandas数据运算拓展.html" class="navigation navigation-next " aria-label="Next page: Pandas数据运算-拓展"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../gitbook/app.js"></script>

    
    <script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
